package LeetCode.leetcode101;

public class Review1 {
    public boolean isSymmetric(TreeNode root) {
        if (root == null) return false;
        if (root.right != null && root.left != null){
            return isTheSame(root.left,root.right);
        }
        return false;
    }
    public static boolean isTheSame(TreeNode left, TreeNode right){
        if (left == null && right == null) return true;
        if (left != null && right != null){
            if (left.val == right.val) {
                return isTheSame(left.left,right.right) && isTheSame(left.right,right.left);
            }
        }
        return false;
    }
}
